//
//  ZJDiscussViwe.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/9/2.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJDiscussViwe.h"

@interface ZJDiscussViwe ()
/** imageView */
@property (nonatomic, strong) UIImageView *imageView;
@end

@implementation ZJDiscussViwe

- (instancetype)initWithFrame:(CGRect)frame dict:(NSDictionary *)dict
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.imageView];
        [self addSubview:self.titleLabel];
        
        self.imageView.image = [UIImage imageNamed:[NSString isNilStringReturnString:[dict objectForKey:@"image"]]];
        self.titleLabel.text = [NSString isNilStringReturnString:[dict objectForKey:@"title"]];
    }
    return self;
}


#pragma mark - Setter


#pragma mark - Getters
- (UIImageView *)imageView{
    if (_imageView == nil){
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.width)];
        _imageView.contentMode = UIViewContentModeCenter;
//        _imageView.clipsToBounds = YES;
    }
    return _imageView;
}

- (UILabel *)titleLabel{
    if (_titleLabel == nil){
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.imageView.bottom, self.width, self.height - self.width)];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.font = [UIFont subTitleTextFont];
        _titleLabel.textColor = [UIColor textBlackColor];
    }
    return _titleLabel;
}

@end
